<template>
  <div class="wrapper">
    <swiper :options="swiperOptions" v-if="showSwiper">
      <swiper-slide v-for="item in swiperList" :key="item.id">
        <img class="swiper-img" :src="item.imgUrl" alt="">
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  data () {
    return {
      swiperOptions: {
        // pagination: {
        //   el: '.swiper-pagination'
        // },
        loop: true,
        autoplay: true
      }
    }
  },
  props: {
    swiperList: Array
  },
  computed: {
    showSwiper () {
      return this.swiperList.length
    }
  }

}
</script>

<style scoped>
  .wrapper{
    width: 100%;
    height: 0;
    overflow: hidden;
    padding-bottom: 31%;
    background: #ccc;
  }
  .swiper-img{
    width: 100%;
  }
</style>
